<?php
include_once '../connexpdo.php';
$query = "SELECT * From problematique WHERE CategPrinc = " . $_POST ['idEnvoiAjax'] . " AND actif = 1";
$return = $connexion->query ( $query );
$vretour = array ();

if ($return->rowCount () == 0) {
	$data [] = array (
			"id" => "",
			"nature" => "",
			"actif" => "" 
	);
	array_push ( $vretour, $data );
} else {
	while ( $row = $return->fetch () ) {
		$data [] = array (
				"id" => $row ['id'],
				"nature" => utf8_array ( $row ['nature'] ),
				"actif" => $row ['actif'] 
		);
		array_push ( $vretour, $data );
	}
}

echo json_encode ( $data );
function utf8_array($data) {
	return utf8_encode ( $data );
}
?>